package com.xxc.exam.controller

import com.xxc.exam.entity.pojo.Category
import com.xxc.exam.entity.pojo.Manager
import com.xxc.exam.entity.vo.CategoryVO
import com.xxc.exam.service.CategoryService
import com.xxc.response.anotation.ResponseResult
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import java.math.BigInteger

@RestController
@ResponseResult
class CategoryController {

    @Autowired
    lateinit var categoryService: CategoryService

    @GetMapping("/categories")
    fun getAllCategories(@SessionAttribute auth:Manager):List<CategoryVO>{
        return categoryService.selectAllEntities(auth.id!!)
    }

    /**
     * 添加新分类
     */
    @PostMapping("/category")
    fun addCategory (@RequestParam name:String,@RequestParam pid:BigInteger?) {

    }

    /**
     * 通过分类id删除分类
     */
    @DeleteMapping("/category")
    fun deleteCategory(@RequestParam id: BigInteger) {

    }

    /**
     * 通过分类id更新分类名称
     */
    @PutMapping("/category")
    fun updateCategory(@RequestParam id:BigInteger,@RequestParam name:String){

    }
}